﻿using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using System.Threading;
using System.Globalization;
using System.IO;
using System.Text;

using CE.Image;
using CE.User;
using CE.Company;
using CE.Global;

public partial class car_insurance_Default : MyLanguageAndSessionBasePage
{
    protected void Page_Load(object sender, EventArgs e)
    {
        Master.Page.Title = Resources.Title.CITitle;

        LiteralControl newln = new LiteralControl(Environment.NewLine);
        HtmlMeta language = new HtmlMeta();
        language.Name = "language";
        language.Content = Resources.Title.PageLanguage;

        HtmlMeta keywords = new HtmlMeta();
        keywords.Name = "keywords";
        keywords.Content = Resources.Title.CIKeyword;

        HtmlMeta description = new HtmlMeta();
        description.Name = "description";
        description.Content = Resources.Title.CIDescription;

        Page.Header.Controls.AddAt(10, new LiteralControl(Environment.NewLine));
        Page.Header.Controls.AddAt(11, language);
        Page.Header.Controls.AddAt(12, new LiteralControl(Environment.NewLine));
        Page.Header.Controls.AddAt(13, keywords);
        Page.Header.Controls.AddAt(14, new LiteralControl(Environment.NewLine));
        Page.Header.Controls.AddAt(15, description);
        string _strCXLive = CE.Configuration.MyConfigurationManager.GetAppSettingValue("TH.IsCXLive");
        if (_strCXLive == "0")
        {
            if (Session[CE.Global.General.Guest] == null)
            {
                //Response.Redirect("~/home.aspx");
            }
            //else if (Session[CE.Global.General.Guest].ToString() == "Provider")
            //{
            //    if (Session[CE.Global.General.UserId] == null)
            //    {
            //        Response.Redirect("~/Provider/ProviderSecureLogin.aspx");
            //    }
            //}
        }

        if (Session[General.UserId] != null)
        {
            if (Session[General.UserTypeId].ToString() != CE.Global.CEUserType.Provider.ToString())
            {
                //Response.Redirect("~/user/viewresulthistory.aspx");
            }
            else
            {
                //Response.Redirect("car-and-policy-details.aspx");
            }
        }
        else
        {
            if (_strCXLive == "1")
            {
                //Response.Redirect("~/car-insurance/");
            }
            else
            {
                //if (Session["Language"].ToString() == "th-TH")
                //{
                //    Response.Redirect("~/car-insurance/car-and-policy-details.aspx");
                //}
                //else
                //{
                //    Response.Redirect("~/en/car-insurance/car-and-policy-details.aspx");
                //}
                
            }
        }
    }
}
